package auth;

import java.util.regex.Matcher; 
import java.util.regex.Pattern;

public class ParseXML {

	String text;
	
	public ParseXML(String text){
		this.text = text;
	}
	
	
	
	
	public String getUID(){
		String success = null;
		String uid = null;
		Pattern p = Pattern.compile("(.*)<cas:authenticationSuccess>(.*)</cas:authenticationSuccess>(.*)");
		Matcher m = p.matcher(text);
		while (m.find() == true) { 
			success = m.group(2).trim();
			p = Pattern.compile("(.*)<cas:user>(.*)</cas:user>(.*)");
			m = p.matcher(success);
			while (m.find() == true) { 
				uid = m.group(2).trim();
			}
		}
		
		return uid;
	}
}